function insertSort(arr, target) {
  if (arr.length === 0) {
    arr.push(target)
    return
  }
  for (let i = arr.length-1; i >= 0; i--) {
    if (target > arr[i]){
      arr.splice(i+1, 0, target)
      break
    }
    if(i === 0) arr.unshift(target)
  }
}

function sort(arr) {
  let result = []
  for (let i = 0; i < arr.length; i++) {
    insertSort(result, arr[i])
  }
  return result
  coe
}

let arr = []
for (let i = 0; i < 15; i++){
  arr.push(Math.floor(Math.random() * 40))
}
console.log(arr)
console.log(sort(arr))
